package com.honeywen.mymvc.leetcode;

/**
 * @author weiw@opera.com
 * @date 2018/9/9 下午1:04
 */
public class LengthLastTest {

    public static void main(String[] args) {

        System.out.println(lengthOfLastWorld(" "));

    }

    public static int lengthOfLastWorld(String s) {

        if (s == null || s.length() == 0) {
            return 0;
        }

        String[] split = s.split(" ");
        if (split.length == 0) {
            return 0;
        }
        return split[split.length - 1].length();

    }
}
